﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Antlr.Runtime;
using Antlr.Runtime.Tree;
using OWLServerQL.dominio;
using OWLServer.owl.tipos;

namespace OWLServerQL
{
    class Program
    {
        static void Main(string[] args)
        {
            /*try
            {*/
                /*string file = "C:\\Users\\SnOw\\Desktop\\Cosas PFC\\Lenguaje individuos.TXT";
                ANTLRFileStream input = new ANTLRFileStream(file);
                OwlServerQLLexer lexer = new OwlServerQLLexer(input);

                CommonTokenStream tokens = new CommonTokenStream(lexer);

                OwlServerQLParser parser = new OwlServerQLParser(tokens);

            
                parser.inicio_consulta();
                Consulta e = parser.ConsultaFinal;
                Console.Write(e);

                Console.WriteLine();

                foreach (ErrorOwlServerLQ er in lexer.errores)
                {
                    Console.WriteLine(er.ToString());
                }

                foreach (ErrorOwlServerLQ er in parser.Errores)
                {
                    Console.WriteLine(er.ToString());
                }*/
                IfzOWLServerQL owl = new OwlServerQL();
                //Console.WriteLine(owl.conversorOwlServerQLToXML("SELECT INDIVIDUALS SAME AS ALL FROM \"http://mami.uclm.es/rhervas/ontologies/2009/2/DevOnt.owl#\";"));
                //Console.WriteLine(owl.conversorOwlServerQLToXML("SELECT INDIVIDUALS WHERE CLASS AS ALL FROM \"http://mami.uclm.es/rhervas/ontologies/2009/2/DevOnt.owl#\";"));
                Console.WriteLine(owl.conversorOwlServerQLToXML("SELECT INDIVIDUALS DISTINCT ALL FROM \"http://mami.uclm.es/rhervas/ontologies/2009/2/DevOnt.owl#\";"));
                //Console.WriteLine(owl.conversorOwlServerQLToXML("SELECT INDIVIDUALS WHERE DATATYPE PROPERTY AS ALL = \"1\" FROM \"http://mami.uclm.es/rhervas/ontologies/2009/2/DevOnt.owl#\";"));
                //Console.WriteLine(owl.conversorOwlServerQLToXML("SELECT INDIVIDUALS WHERE OBJECT PROPERTY AS \"linkedTo\" = ALL FROM \"http://mami.uclm.es/rhervas/ontologies/2009/2/DevOnt.owl#\";"));
                //Console.WriteLine(owl.conversorOwlServerQLToXML("SELECT INDIVIDUALS WHERE OBJECT PROPERTY AS \"combined\" = \"b\" FROM \"http://mami.uclm.es/rhervas/ontologies/2009/2/DevOnt.owl#\";"));
                //Console.WriteLine(owl.conversorOwlServerQLToXML("SELECT INDIVIDUALS WHERE OBJECT PROPERTY AS \"combined\" = \"b\" FROM \"http://mami.uclm.es/rhervas/ontologies/2009/2/DevOnt.owl#\";"));
                //Console.WriteLine(owl.conversorOwlServerQLToXML("SELECT INDIVIDUALS WHERE DATATYPE PROPERTY AS \"CPU\" > \"0\" OR \"CPU\" <= \"0\" FROM \"http://mami.uclm.es/rhervas/ontologies/2009/2/DevOnt.owl#\";"));
                //Console.WriteLine(owl.conversorOwlServerQLToXML("SELECT INDIVIDUALS WHERE DATATYPE PROPERTY AS \"CPU\" > \"0\" OR \"CPU\" <= \"0\" FROM \"http://maaaaaami.uclm.es/rhervas/ontologies/2009/2/DevOnt.owl#\";"));
                //Console.WriteLine(owl.conversorOwlServerQLToXML("SELECT INDIVIDUALS WHERE CLASS AS \"claseI1\" AND (NOT \"claseI2\" OR \"claseI3\" OR \"claseI4\") and WHERE OBJECT PROPERTY AS \"propiedadO1\" = \"individuoO1\" AND (NOT \"propiedadO2\" != \"individuo2O\" OR \"propiedadO\" = \"individuoO3\") OR WHERE DATATYPE PROPERTY AS \"propiedadD1\" = \"valorD1\" AND (NOT \"propiedadD2\" != \"valorD2\" OR \"propiedadD\" = \"valorD2\") AND SAME AS \"individuoS1\" AND \"individuoS2\" OR DISTINCT \"individuoD1\" OR \"individuoD2\" FROM \"ontologia\";"));
                //Console.WriteLine(owl.conversorOwlServerQLToXML("SELECT INDIVIDUALS WHERE CLASS AS \"claseI1\" AND (NOT \"claseI2\" OR \"claseI3\" OR \"claseI4\") and WHERE OBJECT PROPERTY AS \"propiedadO1\" = \"individuoO1\" AND (NOT \"propiedadO2\" != \"individuo2O\" OR \"propiedadO\" = \"individuoO3\") OR WHERE DATATYPE PROPERTY AS \"propiedadD1\" = \"valorD1\" AND (NOT \"propiedadD2\" != \"valorD2\" OfR \"propiedadD\" = \"valorD2\") AND SdAME AS \"individuoS1\" AND \"individuoS2\" OR DISTdINCT \"individuoD1\" OR \"individuoD2\" FROM \"ontologia\";"));
                //Console.WriteLine(owl.conversorOwlServerQLToXML("SELECT INDIVIDUALS WHERE CLASS AS \"claseI1\" AND (NOT \"claseI2\" OR \"claseI3\" OR \"claseI4\") and WHERE OBJECT PROPERTY AS \"propiedadO1\" = \"individuoO1\" AND (NOT \"propiedadO2\" != \"individuo2O\" OR \"propiedadO\" = \"individuoO3\") OR WHERE DATATYPE PROPERTY AS \"propiedadD1\" = \"valorD1\" AND (NOT \"propiedadD2\" != \"valorD2\" OR \"propiedadD\" = \"valorD2\") AND SAME AS \"individuoS1\" AND \"individuoS2\" OR DISTINCT OR DISTINCT \"individuoD1\" OR \"individuoD2\" FROM OR \"individuoD2\" \"ontologia\";"));
            /*}
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }*/
            Console.ReadLine();
        }

        private static void XmlArrayItem(string p, Type type)
        {
            throw new NotImplementedException();
        }
    }
}
